<template>
	<view>
		<view class="main">
			<view class="kuang">
				<view class="tan" v-for="(item,index) in menu" @click="jump" @longtap="tap">
					<image class="image1" src="../../static/users/lun2.png" mode="aspectFill"></image>
					<view class="title">
						天气真好 秋季到来落叶枯黄。
					</view>
					<image class="image2" src="../../static/users/hearer.png" mode="aspectFill"></image>
					<view class="name">
						山海未眠
					</view>
					<image @click.stop="menu[index].show=true" v-if="!item.show" class="image3"
						src="../../static/users/zan.png" mode="aspectFill"></image>
					<image @click.stop="item.show=false" v-if="item.show" class="image3" src="../../static/users/zanguo.png"
						mode="aspectFill"></image>

					<view class="num_zan">
						6
					</view>
				</view>
			</view>

			<view class="bottom"></view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				num: 1,
				menu: [],
				list: []
			}
		},
		methods: {
			change(index) {
				this.num = index
			},
			jump(){
				uni.navigateTo({
					url:"../Postdetails/Postdetails"
				})
			},
			tap(){
				var _this=this
				uni.showModal({
					content:"确定删除该帖子？",
					success:res=>{
						if(res.confirm){
							setTimeout(()=>{
								_this.zaitrue()
							},800)
							
						}
					}
				})
			},
			zaitrue(){
				uni.showModal({
					content:"删除后将无法在恢复",
					success:res=>{
						if(res.cancel){
							
							uni.showToast({
								title:"已取消删除",
								icon:"none"
							})
							
						}
					}
				})
			}
		},
		onLoad() {
			for (var i = 0; i < 10; i++) {
				this.menu.push({
					show: false
				})
			}

			for (var j = 0; j < 10; j++) {
				this.list.push({
					shower: false
				})
			}
			console.log(this.list);
		}
	}
</script>

<style lang="scss">
	page {
		background: #F2F4FA;
	}

	.main {
		width: 750rpx;
		height: 1435rpx;
		background: #FFFFFF;
		border-radius: 40rpx;
		position: relative;
		position: absolute;
		.kuang {
			margin: 35rpx 0 0 0rpx;
			display: flex;
			flex-wrap: wrap;
			justify-content: space-evenly;

			.tan {

				width: 334rpx;
				height: 620rpx;
				position: relative;

				.image1 {
					width: 334rpx;
					height: 460rpx;

				}

				.title {
					margin: 20rpx 0 0 11rpx;
					font-size: 24rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #181818;
					line-height: 36rpx;
				}

				.image2 {
					margin: 19rpx 0 0 9rpx;
					width: 45rpx;
					height: 45rpx;
				}

				.name {
					position: absolute;
					bottom: 45rpx;
					left: 70rpx;
					font-size: 20rpx;
					font-family: PingFang SC;
					font-weight: 300;
					color: #666666;
				}

				.image3 {
					position: absolute;
					bottom: 46rpx;
					left: 276rpx;
					width: 36rpx;
					height: 30rpx;
				}

				.num_zan {
					position: absolute;
					right: 4rpx;
					bottom: 46rpx;
					font-size: 20rpx;
					font-family: PingFang SC;
					font-weight: 300;
				}
			}
		}

		.bottom {
			width: 750rpx;
			height: 200rpx;
		}


	}
</style>
